package bean;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table
@NamedQueries({
	@NamedQuery(name = "Funcionario.findAll", query = "SELECT f FROM Funcionario f"),
	@NamedQuery(name = "Funcionario.findByIdeFun", query = "SELECT f FROM Funcionario d WHERE f.ideFun = :ideFun"),
	@NamedQuery(name = "Funcionario.findByNomFun", query = "SELECT f FROM Funcionario d WHERE f.nomFun = :nomFun"),
	@NamedQuery(name = "Funcionario.findByParteNomFun", query = "SELECT f FROM Funcionario d WHERE f.nomFun like :nomFun"),
	@NamedQuery(name = "Funcionario.findByCarFun", query = "SELECT f FROM Funcionario d WHERE f.carFun = :carFun"),
	@NamedQuery(name = "Funcionario.findBySalFun", query = "SELECT f FROM Funcionario d WHERE f.salFun = :salFun")
})
public class Funcionario implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Basic(optional=false)
	@Column(name = "IdeFun")
	private Integer ideFun;
	@Column(name = "NomFun")
	private String nomFun;
	@Column(name = "TelFun")
	private String telFun;
	@Column(name = "CarFun")
	private String carFun;
	@Column(name = "SalFun")
	private Double salFun;
	@JoinColumn(name="IdeDep", referencedColumnName="IdeDep")
	@ManyToOne(optional=false)
	private Departamento departamento;
	
	public Funcionario() {
		
	}

	public Integer getIdeFun() {
		return ideFun;
	}

	public void setIdeFun(Integer ideFun) {
		this.ideFun = ideFun;
	}

	public String getNomFun() {
		return nomFun;
	}

	public void setNomFun(String nomFun) {
		this.nomFun = nomFun;
	}

	public String getTelFun() {
		return telFun;
	}

	public void setTelFun(String telFun) {
		this.telFun = telFun;
	}

	public String getCarFun() {
		return carFun;
	}

	public void setCarFun(String carFun) {
		this.carFun = carFun;
	}

	public Double getSalFun() {
		return salFun;
	}

	public void setSalFun(Double salFun) {
		this.salFun = salFun;
	}

	public Departamento getDepartamento() {
		return departamento;
	}

	public void setDepartamento(Departamento departamento) {
		this.departamento = departamento;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (ideFun != null ? ideFun.hashCode() : 0);
		return hash;
	}
	
	@Override
	public boolean equals(Object object) {
		if(!(object instanceof Funcionario)) {
			return false;
		}
		
		Funcionario other = (Funcionario) object;
		if((this.ideFun == null && other.ideFun != null) || (this.ideFun != null && !this.ideFun.equals(other.ideFun))) {
			return false;
		}
		
		return true;
	}
	
	@Override
	public String toString() {
		return "bean.Funcionario[ideFun=" + ideFun + "]";
	}
	
}
